package cn.tworice.blog.web;

import cn.tworice.blog.service.DyService;
import com.lmk.core.web.support.api.RequestResult;
import com.lmk.core.web.support.api.StatusCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/douyin")
@Api(tags = "抖音解析模块接口")
@CrossOrigin
@Slf4j
public class DouyinController {

    @Autowired
    private DyService service;


    @PostMapping("")
    @ApiOperation("通过抖音分享链接获取无水印视频")
    public RequestResult getUrl(@RequestParam @ApiParam("包含链接的分享内容") String url){
        if(url==null || url.equals("null")){
            return new RequestResult(new StatusCode(403,"请求内容不能为空"));
        }
        return service.getDouyinUrl(url);
    }

}
